#include <stdio.h>
#define N 100
int FindNum(int s[],int num,int n)
{
    int low=0,high=n-1,mid;
    while(low<=high)
    {
        mid=(low+high)/2;
        if(s[mid]>num)
            high=mid-1;
        else if(s[mid]<num)
            low=mid+1;
        else
            return mid;
    }
    return -1;
}
void SelectSort(int s[],int n)
{
    int i,j,k,temp;
    for(i=1;i<n;i++)
    {
        k=i;
        for(j=i;j<n;j++)
        {
            if(s[k-1]>s[j])
            {
                k=j+1;
            }
        }
        temp=s[i-1];
        s[i-1]=s[k-1];
        s[k-1]=temp;
    }
}
void ReadScore(int score[],int n)
{
    int i;
    for(i=0;i<n;i++)
    {
        printf("please input the No.%d number:",i+1);
        scanf("%d",&score[i]);
    }
}
void OutScore(int score[],int n)
{
    int i;
    for(i=0;i<n;i++)
    {
        printf("%d ",score[i]);
    }
}
void main()
{
    int s[N],n,num;
    printf("please tell me how many numbers you want to input:");
    scanf("%d",&n);
    ReadScore(s,n);
    SelectSort(s,n);
    OutScore(s,n);
    printf("\ninput the number you want to find:");
    scanf("%d",&num);
    if(FindNum(s,num,n)>=0)
        printf("The number is found and it's No.%d number.\n",FindNum(s,num,n)+1);
    else
        printf("The number is not found!\n");
}
